Skip to content

remove go.layout.shape from the tutorial #2104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed

Conversation

Mahdis-z
Copy link
Contributor

@Mahdis-z Mahdis-z commented Jan 20, 2020

closes #2093

@nicolaskruchten
Copy link
Contributor

This is the right idea! Please apply the same changes in any file that contains go.layout.something e.g. https://plot.ly/python/images/ and https://plot.ly/python/dropdowns/ (do a search for go.layout. with the trailing . and you'll find a bunch more)

@nicolaskruchten
Copy link
Contributor

This one is pretty important: https://plot.ly/python/text-and-annotations/

fig.update_layout(title_text="A Bar Chart", title_font=dict(size=30))
fig.update_layout(title=dict(text="A Bar Chart"), font=dict(size=30))
fig.update_layout({"title": {"text": "A Bar Chart", "font": {"size": 30}}})
fig.update_layout(title=dict(text="A Bar Chart", font=dict(size=30)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we want to keep the go.layout.Title because we're showing equivalent syntaxes, although the recommended one does not use go.layout.

@emmanuelle
Copy link
Contributor

There is just one place where we want I think to keep the go.layout for the sake of pedagogy but otherwise this one is ready: 💃.

@nicolaskruchten nicolaskruchten changed the base branch from master to doc-prod January 28, 2020 15:11
@@ -0,0 +1 @@
pk.eyJ1IjoiZXRwaW5hcmQiLCJhIjoiY2luMHIzdHE0MGFxNXVubTRxczZ2YmUxaCJ9.hwWZful0U2CQxit4ItNsiQ
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this file plz

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gitignore didn't ignore it! "git rm --cached .mapbox_token" removes it from repo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK but it's still here... you'll have to remove it again and push again :)

hovertext=["Text A", "Text B", "Text C"]
))

fig.add_trace(go.Scatter(x=[0, 1, 2], y=[1, 3, 2], mode="markers", hovertext=["Text A", "Text B", "Text C"]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is probably too long

x=[0, 1, 2, 3, 4, 5, 6, 7, 8],
y=[0, 4, 5, 1, 2, 2, 3, 4, 2]
))
fig.add_trace(go.Scatter(x=[0, 1, 2, 3, 4, 5, 6, 7, 8], y=[0, 1, 3, 2, 4, 3, 4, 6, 5]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these were good before

]
)

dict(x=2, y=5, xref="x", yref="y", text="dict Text", showarrow=True, arrowhead=7, ax=0, ay=-40)])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

too long

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also let's convert this to add_annotation

z=1
)
),
scene=dict(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turn this into update_scenes()

xaxis=dict(title_text="", type="date"),
yaxis=dict(title_text="", type="category"),
zaxis=dict(title_text="", type="log"),
annotations=[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert to add_annotation

size=16,
color="#ffffff"
),
dict(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no dict needed

@@ -42,17 +42,12 @@ import plotly.graph_objects as go

fig = go.Figure(go.Scatter(
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
y = [28.8, 28.5, 37, 56.8, 69.7, 79.7, 78.5, 77.8, 74.1, 62.6, 45.3, 39.9]
))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these parentheses should stay on their own line


fig.update_layout(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i consider this cleaner... not that strong an opinion

@nicolaskruchten
Copy link
Contributor

Can you rebase this onto the latest doc-prod please to resolve conflicts?

colorscale=[[0,'rgb(0, 0, 0)'],[1,'rgb(0, 0, 0)']],
autocolorscale=False,
showscale=False,
geo='geo2'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these trailing parentheses should go back to being on their own line please

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping that this PR would be a simple "remove all go.layout.whatever but it actually contains a lot of hard-to-review/hard-to-undo changes like this, so is it possible to please break this up into multiple easier-to-review PRs? like one with just the "go.layout.whatever to dict" change and another with the replacement of = to = etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, to make it less painful I created #2171 for removal of go.layout.* and will take care of formatting later

@Mahdis-z Mahdis-z closed this Feb 12, 2020
@Mahdis-z Mahdis-z deleted the add_shape branch February 12, 2020 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants